<%@ include file="../common.jsp" %>

<script type="text/javascript">
	loadCategAndSubCategForReports();
</script>

<div align="center">
	<table class="bodyTable">
		<tr class="formSpacingRow"><td></td></tr>
		<tr align="right" style="width: 100%;" >
			<td >
				<table class="filtersTable zeroBorder" style="width: 100%;">
					<tr class="tableChildHeaderColor" align="left" style="width: 100%;">
						<td>
							<table style="width: 100%;" class="zeroBorder">
								<tr>
									<td style="width: 80%;">
										<table class="zeroBorder">
											<tr>
												<td class="spacingColumnWidthLess"></td>
												<td align="left">
													<img alt="" src="./customTheme/Icons/BlueLotus_DMS_icons-11.png">
												</td>
												<td class="spacingColumnWidthLess"></td>
												<td style="vertical-align: middle;"><span class="tableMainHeaderFont"> SEARCH FOR DOCUMENTS NEAR EXPIRY </span></td>
											</tr>
										</table>
									</td>
									<td align="right" style="width: 20%;" >
										<table class="zeroBorder">
											<tr id="toggleDiv" class="displayNone" style="background-color: #000000; border-color: #000000; border-style: solid;">
												<td class="togglerFont errorMessage">
													MODIFY SEARCH
												</td>
												<td>
													<img alt="" src="./customTheme/Icons/BlueLotus_DMS_icons-43.png" onclick="javascript:showDiv('#nearExpiryDocsFilter','#toggleDiv')">
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr class="formSpacingRow formBlockColor"><td></td></tr>
					<tr align="center">
						<td>
							<div id="nearExpiryDocsFilter" class="formBlockColor">
								<form:form commandName="docReports" id="nearExpiryReports">
								<table style="width: 100%;">
									<tr>
										<td class="formLabel">Authorized Signatory Id</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField"><form:input readonly="true" path="authSignId" id="authSignId"/></td>
										<td class="spacingColumnWidthMedium"></td>
										<td class="formLabel">Type</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField"><form:select
											path="docTypeId" id="docTypeId">
												<form:option value="0">ALL</form:option>
												<c:forEach items="${docTypeMap}" var="docTypeMap">
													<form:option value="${docTypeMap.value.dtId}">${docTypeMap.value.dtName}</form:option>
												</c:forEach>
												</form:select>
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>
									<tr class="formSpacingRow"><td></td> </tr>
									<tr>
										<td class="formLabel">Authorized Signatory Name</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField">
											<form:input readonly="true" path="authSign" id="authSign"/>
											<img alt="" src="./customTheme/Icons/BlueLotus_DMS_icons-30.png" onclick="showUserLookUpDialogForWF('ROLE_AUTHSIGN');" ></td>
										</td>
										<td class="spacingColumnWidthMedium">
										<td class="formLabel">Category</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField"><form:select path="docCategoryId" id="docCategoryId">
								 			 	<form:option value="0">ALL</form:option>
								 			 </form:select>
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>
									<tr class="formSpacingRow"><td></td> </tr>
									<tr>
										<td class="formLabel">Business Unit</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField"><form:select path="docLocId" id="docLocId" onchange="loadDepttForBUForReports(this.id,'docDepttId');">
						 					<form:option value="0">ALL</form:option>
								 				<c:forEach items="${businessUnitMap}" var="businessUnitMap">
								 					<form:option value="${businessUnitMap.key}">${businessUnitMap.value}</form:option>
								 				</c:forEach>
								 			 </form:select>
									 	</td>
										<td class="spacingColumnWidthMedium"></td>
										<td class="formLabel">Sub-Category</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField">
												<form:select path="docSubCategoryId" id="docSubCategoryId"> 
								 			 		<form:option value="0">ALL</form:option>
								 			 	</form:select>
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>
									<tr class="formSpacingRow"><td></td> </tr>
									<tr>
										<td class="formLabel">Issuing Authority</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField">
											<form:input path="docIssuingAuthority"/>
									 	</td>
										<td class="spacingColumnWidthMedium"></td>
										<td class="formLabel">Agreement Entered with</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField">
											<form:input path="docEnteredWith"/>
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>
									<tr class="formSpacingRow"><td></td> </tr>
									<tr>
										<td class="formLabel">Department</td>
										<td class="spacingColumnWidthLess"></td>
										<td align="left" class="formField"><form:select path="docDepttId" id="docDepttId">
								 			 	<form:option value="0">ALL</form:option>
								 			 </form:select></td>
										<td class="spacingColumnWidthMedium"></td>
										<td class="formLabel">
											<sec:authorize access="hasAnyRole('ROLE_CC','ROLE_CCC','ROLE_SO','ROLE_OWNER')">
												Company
											</sec:authorize>
										</td>
										<td class="spacingColumnWidthLess"></td>
										<td class="formField">
											<sec:authorize access="hasAnyRole('ROLE_CC','ROLE_CCC','ROLE_SO','ROLE_OWNER')">
											<form:select path="docCompanyId">
												<form:option value="0">All</form:option>
												<c:forEach items="${companyMap}" var="company">
												<form:option value="${company.key}">${company.value}</form:option>
												</c:forEach>
											</form:select>
											</sec:authorize>
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>
									<tr class="formSpacingRow"><td></td> </tr>
									<tr>
										<td colspan="6"></td>
										<td align="right">
											<input style="width: 150px;" class="formButton ui-corner-all" type="button" value="GENERATE REPORT" onclick="loadNearExpiryDocReportsTable();">
										</td> 
										<td class="spacingColumnWidthLess"></td>
									</tr>
									<tr>
										<td colspan="6"></td>
										<td align="right">
											<img alt="" src="./customTheme/Icons/BlueLotus_DMS_icons-43.png" class="displayBlock" onclick="javascript:hideDiv('#nearExpiryDocsFilter','#toggleDiv')">
										</td> 
									</tr>
								</table>
								</form:form>
							</div>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr class="formSpacingRow"><td></td> </tr>
		<tr class="formSpacingRow"><td></td> </tr>
		<tr>
			<td>
				<div id="nearExpiryDocReports"></div>
			</td>
		</tr>
	</table>
</div>